<template>
  <div>
    
    <div class="banner" @click="handleBannerClick">
      <img class="banner-img" :src="bannerImg" alt="">
      <div class="banner-info">
        <div class="banner-title">{{sightName}}</div>
        <div class="banner-num">
          <span class="iconfont">&#xe632;</span>{{gallaryImgs.length}}</div>
      </div>
    </div>
    <fade>
      <gallary :imgs="gallaryImgs" v-if="showGallary" @close="closeGallary"></gallary>
    </fade>
  </div>
</template>
<script>
import Gallary from "components/gallary/Gallary"
import Fade from "components/fade/Fade"

export default {
  data () {
    return {
      imgs: this.gallaryImgs,
      showGallary: false
    }
  },
  props: {
    gallaryImgs:Array,
    bannerImg: String,
    sightName: String
  },
  components: {
    Gallary,
    Fade
  },
  methods: {
    handleBannerClick () {
      this.showGallary = true
    },
    closeGallary () {
      this.showGallary = false
    }
  }
};
</script>
<style lang="scss" scoped>
.banner {
  height: 0;
  overflow: hidden;
  padding-bottom: 55%;
  position: relative;

  .banner-img {
    width: 100%;
  }
  .banner-info {
    display: flex;
    align-items: center;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    line-height: 0.6rem;
    background-image: linear-gradient(
      top,
      rgba(0, 0, 0, 0),
      rgba(0, 0, 0, 0.8)
    );
    .banner-title {
      flex: 1;
      color: #fff;
      padding: 0 0.2rem;
      font-size: 0.32rem;
    }
    .banner-num {
      padding: 0 0.4rem;
      height: 0.39rem;
      line-height: 0.39rem;
      border-radius: 0.2rem;
      background: rgba(0, 0, 0, 0.8);
      color: #fff;
      font-size: 0.24rem;
      span {
        font-size: 0.24rem;
        margin-right: 0.05rem;
      }
    }
  }
}
</style>


